package com.itheima.demo02;

import java.util.TreeSet;

public class MainClass03 {
    public static void main(String[] args) {
        TreeSet<String> str = new TreeSet<>((o1,o2) -> {
            int result = o1.length() - o2.length();
            return result == 0 ? o1.compareTo(o2) : result;
        });

        str.add("c");
        str.add("acd");
        str.add("ac");
        str.add("abvc");
        str.add("ac");

        for (String s : str) {
            System.out.println(s);
        }
    }
}
